<!DOCTYPE html>
<meta charset=utf-8>
<title>Frame that detaches itself and tries to use Cache API</title>
<script>

// Tries to access Cache API after removing itself.
window.onmessage = function(e) {
  var parent = window.parent;
  parent.document.querySelector('iframe').remove();
  caches.open('detached-cache')
    .then(function(cache) {
      // NOTE: Currently this line doesn't execute on detached context.
      return cache.keys();
    })
    .then(function(keys) {
      parent.postMessage({keys: keys, status: 'success'}, '*');
    });
}
</script>
<body>
Hello? Yes, this is iframe.
</body>

